package com.ruoyi.model.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.SNUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.model.mapper.ConstructDataMapper;
import com.ruoyi.model.domain.ConstructData;
import com.ruoyi.model.service.IConstructDataService;

/**
 * 建模数据Service业务层处理
 *
 * @author weihanqiang
 * @date 2025-04-18
 */
@Service
public class ConstructDataServiceImpl implements IConstructDataService
{
    @Autowired
    private ConstructDataMapper constructDataMapper;

    @Autowired
    private SNUtil snUtil;

    /**
     * 查询建模数据
     *
     * @param constructId 建模数据主键
     * @return 建模数据
     */
    @Override
    public ConstructData selectConstructDataByConstructId(Long constructId)
    {
        return constructDataMapper.selectConstructDataByConstructId(constructId);
    }

    /**
     * 查询建模数据列表
     *
     * @param constructData 建模数据
     * @return 建模数据
     */
    @Override
    public List<ConstructData> selectConstructDataList(ConstructData constructData)
    {
        return constructDataMapper.selectConstructDataList(constructData);
    }

    /**
     * 新增建模数据
     *
     * @param constructData 建模数据
     * @return 结果
     */
    @Override
    public int insertConstructData(ConstructData constructData)
    {
        String construct_data_no = snUtil.generateSN("construct_data", "construct_no", "yyyyMMdd", "CON", 4);
        constructData.setConstructNo(construct_data_no);
        constructData.setCreateTime(DateUtils.getNowDate());
        return constructDataMapper.insertConstructData(constructData);
    }

    /**
     * 修改建模数据
     *
     * @param constructData 建模数据
     * @return 结果
     */
    @Override
    public int updateConstructData(ConstructData constructData)
    {
        return constructDataMapper.updateConstructData(constructData);
    }

    /**
     * 批量删除建模数据
     *
     * @param constructIds 需要删除的建模数据主键
     * @return 结果
     */
    @Override
    public int deleteConstructDataByConstructIds(Long[] constructIds)
    {
        return constructDataMapper.deleteConstructDataByConstructIds(constructIds);
    }

    /**
     * 删除建模数据信息
     *
     * @param constructId 建模数据主键
     * @return 结果
     */
    @Override
    public int deleteConstructDataByConstructId(Long constructId)
    {
        return constructDataMapper.deleteConstructDataByConstructId(constructId);
    }
}
